package com.hnchances.grade.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.hnchances.grade.common.group.AddGroup;
import com.hnchances.grade.common.group.UpdateGroup;
import com.hnchances.grade.common.valid.PhoneNumberValid;
import lombok.Data;
import org.apache.ibatis.annotations.Update;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 
 * 
 * @author lpj
 * @email ${email}
 * @date 2022-08-27 15:10:23
 */
@Data
@TableName("user")
public class UserEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id自增，key
	 */
	@TableId
	@Null(message = "新增不能指定id", groups = {AddGroup.class})
	@NotNull(message = "修改必须指定id", groups = {UpdateGroup.class})
	private Integer id;
	/**
	 * 用户名
	 */
	@NotBlank(message = "用户名不能为空",groups = {AddGroup.class, UpdateGroup.class})
	private String userName;
	/**
	 * 密码，md5
	 */
	@NotBlank
	private String passWord;
	/**
	 * 电话号码11位
	 */
	@PhoneNumberValid(groups = {AddGroup.class, UpdateGroup.class})
	private String phone;
	/**
	 * 真实姓名
	 */
	@NotBlank
	private String trueName;
	/**
	 * 0-学生，1-老师，2-领导或管理（可看所有班级）
	 */
	private Integer identity;
	/**
	 * 班级关联ID
	 */
	private Integer classId;
	/**
	 * 课程ID
	 */
	private Integer courseId;
	/**
	 * 学生ID
	 * private Integer studentID；
	 */

	private Integer studentId;
	/**
	 * 注册日期
	 */
	@Null(message = "新增不能指定", groups = {AddGroup.class})
	private Date creatDateTime;
	/**
	 * 修改日期
	 */
	@Null(message = "新增不能指定", groups = {AddGroup.class})
	private Date updateDateTime;
	/**
	 * 最后登录时间
	 */
	@Null(message = "新增不能指定", groups = {AddGroup.class})
	private Date lastLoginDateTime;
	/**
	 * ipv4
	 */
	@Null(message = "新增不能指定ip", groups = {AddGroup.class})
	private String loginIp;
	/**
	 * 修改人ID
	 */
	@Null(message = "新增不能指定修改人", groups = {AddGroup.class})
	private Integer updatebyId;
	/**
	 * 0-正常，1-删除
	 */
	@TableLogic(value = "1", delval = "0")
	private Integer status;
	/**
	 * 0-未审核,1-审核
	 */
	private Integer verify;

}
